﻿using Newtonsoft.Json;
using System.IO;
using System.Text;

namespace Windows8Accelerator.Core.Xaml.Serialization
{
    public static class JsonSerializer
    {
        public static string Serialize(object instance)
        {
            return JsonConvert.SerializeObject(instance);
        }

        public static T Deserialize<T>(string json)
            where T:class
        {
            if (string.IsNullOrEmpty(json))
                return null;
            return JsonConvert.DeserializeObject<T>(json);
        }
    }
}
